
// ...other : rest参数

// let arr = ["99", 123, "hello", "!"]
// let [...ot] = arr
// console.log(ot)
/*let obj = {
  name: "张三",
  age: 18,
  active() {
    alert("hi")
  }
}
const { ...ot } = obj
console.log(ot)*/

// ...[] ...{} 扩展运算符， rest参数的逆运算
// let arr1 = ["99", 123, "hello", "!"]
// let arr2 = [...arr1]
// console.log(arr2)

// console.log(["99", 123, "hello", "!"])
// console.log(...["99", 123, "hello", "!"])
// console.log("99", 123, "hello", "!")

//值类型：number, string, boolean, null, undefined
//引用类型(内存地址)：object包括 {}, [], function

/*
// 深拷贝
const a1 = [1, 99, ["a", "b"]]
// const a2 = a1.concat()
// const a2 = [...a1]
// JSON.stringify() 将数组或者对象转成 json字符串
// JSON.parse() 将json字符串 解析为数组或者对象
const a2 = JSON.parse(JSON.stringify(a1))
a2[0] = "000"
a2[2][0] = "aaa"
console.log("a2", a2)
console.log("a1", a1)

// 浅拷贝
const a1 = [1, 99, ["a", "b"]]
const a1 = [1, 99]
// const a2 = a1
// const a2 = a1.concat() // ES5: concat()返回新数组
const a2 = [...a1] // ES6 拷贝数组
a2[0] = 23
console.log("a2", a2)
console.log("a1", a1)*/


// let x = 0
// let y = {} 0x12afed
// const 引用类型的值是可以改的
// let x = {}
// let x1 = x



/*
let arr1 = [1, 0, 8, "q"]
let arr2 = ["oo", "ww"]
let arr3 = [function () {
  alert("hi")
}, "12"]
// console.log(arr1.concat(arr3, arr2))
console.log([...arr1, ...arr2, ...arr3])*/

// 将类数字转换为数组
// Array.from(document.querySelectorAll("*"))
// [...类数组]

// console.log(Array.of(1, 99, "qwe"))

let arr = ["a", "b", "c", "hello", "world", "!"]

// console.log(arr.copyWithin(0, 3))
// console.log(arr.copyWithin(0, 3, 5))
// console.log(arr.fill("x"))
// console.log(arr.fill("x", 3, 5))

// for (let item of arr.keys()) {
// for (let item of arr.values()) {
/*
for (let item of arr.entries()) {
  console.log(item)
}*/

let arr1 = [[1, 99], [3, 4], [[1, 2]]]
// console.log(arr1.flat(2))
// console.log(arr1.flat(Infinity))





